import {Pipe, PipeTransform} from "@angular/core";
/**
 * Created by Administrator on 2017/3/28.
 */
@Pipe({name: 'monthType'})
export class MonthTypePipe implements PipeTransform {
    transform(value: any): string {
        let result: string = "-";
        for (let type of this.types) {
            if (type.value == value) {
                return type.name;
            }
        }
        return "未知"
    }


    types: any = [
        {name: "1月", value: "01"},
        {name: "2月", value: "02"},
        {name: "3月", value: "03"},
        {name: "4月", value: "04"},
        {name: "5月", value: "05"},
        {name: "6月", value: "06"},
        {name: "7月", value: "07"},
        {name: "8月", value: "08"},
        {name: "9月", value: "09"},
        {name: "10月", value: "10"},
        {name: "11月", value: "11"},
        {name: "12月", value: "12"},
    ]


    getTypes(): any {
        return this.types
    }
}